[client]
socket = {{ db_socket_dir }}/{{ db_client }}.sock

[mysqld]
basedir = {{ db_app_base_dir }}
datadir = {{ db_data_dir }}
port = {{ db_port }}
socket = {{ db_socket_dir }}/{{ db_client }}.sock
server-id = {{ server_id.stdout|int }}
tmpdir = {{ db_tmp_dir }}
general-log-file = {{ db_log_dir }}/general.log
slow-query-log-file = {{ db_log_dir }}/{{ db_client }}d-slow.log
pid-file = {{ db_pid_dir }}/{{ db_client }}d.pid
log-error = {{ db_log_dir }}/{{ db_client }}d.err
slow_query_log = on
long_query_time = 1
relay_log = {{ db_client }}-relay
skip_{{ replica_variables_name }}_start = 1
{{ replica_variables_name }}_parallel_type = LOGICAL_CLOCK
{{ replica_variables_name }}_parallel_workers = 32
{{ replica_variables_name }}_pending_jobs_size_max = 134217728
{{ replica_variables_name }}_preserve_commit_order = 1
log_bin = greatdb-bin
binlog_format = row
binlog_cache_size = 2097152
max_binlog_cache_size = 1073741824
binlog_checksum = NONE
binlog_expire_logs_seconds = 1296000
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table = 1
gtid_mode = on
enforce_gtid_consistency = on
binlog_rows_query_log_events = ON
binlog_transaction_dependency_tracking = WRITESET
innodb_change_buffering = all
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_doublewrite = 1
innodb_flush_method = O_DIRECT
innodb_io_capacity = 20000
innodb_io_capacity_max = 40000
innodb_log_buffer_size = 33554432
innodb_log_file_size = 1G
innodb_log_files_in_group = 4
innodb_max_undo_log_size = 2G
innodb_monitor_enable = all
innodb_numa_interleave = ON
innodb_online_alter_log_max_size = 2G
innodb_open_files = 40960
innodb_print_all_deadlocks = on
innodb_purge_rseg_truncate_frequency = 16
innodb_rollback_on_timeout = ON
innodb_temp_data_file_path = ibtmp1:512M:autoextend:max:30720M
innodb_undo_log_truncate = ON
innodb_use_native_aio = ON
federated = 1
transaction_isolation = READ-COMMITTED
init_connect = SET NAMES utf8
character_set_server = utf8mb4
collation_server = utf8mb4_bin
default_authentication_plugin = mysql_native_password
default-time-zone = +08:00
local_infile = OFF
secure_file_priv = ''
ssl = off
lower_case_table_names = 1
innodb_lock_wait_timeout = 20
wait_timeout = 172800
innodb_adaptive_hash_index = OFF
sql_require_primary_key = ON
plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so;mysql_clone.so
internal_tmp_mem_storage_engine = MEMORY
max_allowed_packet = 134217728
max_connect_errors = 18446744073709500000
max_connections = 4000
max_heap_table_size = 536870912
max_prepared_stmt_count = 1048576
lock_wait_timeout = 5
interactive_timeout = 172800
mysqlx = 0
back_log = 5000
group_concat_max_len = 102400
join_buffer_size = 2097152
key_buffer_size = 2097152
sort_buffer_size = 8388608
log_bin_trust_function_creators = 1
log_timestamps = SYSTEM
net_read_timeout = 10000
net_write_timeout = 10000
open_files_limit = 1024000
read_rnd_buffer_size = 16777216
performance-schema-consumer-events_stages_current = on
performance-schema-consumer-events_stages_history = on
performance-schema-consumer-events_statements_current = on
performance-schema-consumer-events_statements_history = on
performance-schema-consumer-events_transactions_current = on
performance-schema-consumer-events_transactions_history = on
performance-schema-consumer-events_waits_current = on
performance-schema-consumer-events_waits_history = on
performance-schema-instrument = %=ON
relay_log_recovery = ON
skip_external_locking = 1
skip_name_resolve = 1
table_definition_cache = 10240
table_open_cache = 20480
table_open_cache_instances = 16
thread_cache_size = 3000
tmp_table_size = 16777216
admin_address = 127.0.0.1
admin_port = 33062
binlog_ignore_db = dbscale_tmp
innodb_buffer_pool_size = {{ innodb_buffer_pool_size|int }}M
innodb_buffer_pool_instances = {{ innodb_buffer_pool_size|int // 1024 }}
innodb_page_cleaners = {{ innodb_buffer_pool_size|int // 1024 }}
innodb_parallel_read_threads = {{ host_processor_cpus|int * 2 }}
innodb_read_io_threads = {{ host_processor_cpus|int * 2 }}
innodb_write_io_threads = {{ host_processor_cpus|int * 2 }}
innodb_thread_concurrency = {{ host_processor_cpus|int * 2 }}